package cn.dzz.action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.dispatcher.mapper.ActionMapping;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.PageContext;

/**
 * @author Echo42
 * @file Struts2
 * @create 2020年08月29日16:00
 */
public class ActionMode3 extends ActionSupport {

    private String username;
    private String password;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String execute() throws Exception {
        System.out.println(username + " " + password);
        return super.execute();
    }

    public String method1(){
        System.out.println("- - - method1 - - -");
        return NONE;
    }

    public String method2(){
        System.out.println("- - - method2 - - -");
        return NONE;
    }

    public String method03(){

        HttpServletRequest httpServletRequest = ServletActionContext.getRequest();
        HttpServletResponse httpServletResponse = ServletActionContext.getResponse();
        ServletContext servletContext = ServletActionContext.getServletContext();

        ActionContext actionContext = ServletActionContext.getActionContext(httpServletRequest);
        ActionMapping actionMapping = ServletActionContext.getActionMapping();
        ValueStack valueStack = ServletActionContext.getValueStack(httpServletRequest);

        PageContext pageContext = ServletActionContext.getPageContext();

        return NONE;
    }


}
